<?php

namespace App\Http\Requests\Home\Auth;

use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;

/**
 * 登录请求
 *
 * Date: 23/03/2018
 * @author George
 * @package App\Http\Requests\Auth
 */
class LoginRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

	/**
	 * 定义验证规则
	 *
	 * Date: 23/03/2018
	 * @author George
	 * @return array
	 */
    public function rules()
    {
        return [
        	'username' => 'required',
			'password' => 'required',
			'guard' => [
				'nullable',
				Rule::in(array_keys(config('auth.guards')))
			]
        ];
    }

	/**
	 * 定义验证提示信息
	 *
	 * Date: 23/03/2018
	 * @author George
	 * @return array
	 */
	public function messages()
	{
		return [
			'username.required' => '请输入用户名',
			'password.required' => '请输入密码',
			'guard.in' => '错误的guard值'
		];
    }
}
